package mao.leetcode.others;

public class leetcode11 {
    public int maxArea(int[] height) {
        int start = 0;
        int end = height.length-1;
        int maxWater = 0;
        while(start<end){
            if(height[start]<height[end]){
                maxWater=Math.max(maxWater,height[start]*(end-start));
                start++;
            }else{
                maxWater=Math.max(maxWater,height[end]*(end-start));
                end--;
            }
        }
        return maxWater;
    }

    public static void main(String[] args) {
        leetcode11 leetcode11 = new leetcode11();
        int[] a ={1,8,6,2,5,4,8,3,7};
        leetcode11.maxArea(a);
    }
}
